package com.example.finalwork.Income;

import android.content.Intent;
import android.graphics.Paint;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;
import android.widget.Toast;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

import com.example.finalwork.MainActivity;
import com.example.finalwork.R;

public class IncomeMainActivity extends AppCompatActivity implements View.OnClickListener {
    TextView income_add,income_update,income_del,income_getall,textView6;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_income);
        income_add = findViewById(R.id.income_add);
        income_update = findViewById(R.id.income_update);
        income_del = findViewById(R.id.income_del);
        income_getall = findViewById(R.id.income_getall);
        textView6 = findViewById(R.id.textView6);

        findViewById(R.id.income_add).setOnClickListener(this);
        findViewById(R.id.income_del).setOnClickListener(this);
        findViewById(R.id.income_update).setOnClickListener(this);
        findViewById(R.id.income_getall).setOnClickListener(this);
        findViewById(R.id.textView6).setOnClickListener(this);

        //Intent intent = getIntent();
        //tring data = intent.getStringExtra("UserName");
        //Toast.makeText(this,MainActivity.data,Toast.LENGTH_SHORT).show();

        Drawable dwincome_add = getResources().getDrawable(R.drawable.incomeadd);
        dwincome_add.setBounds(0, 0, 100, 100);
        income_add.setCompoundDrawables(dwincome_add, null, null, null);
        income_add.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        income_add.getPaint().setAntiAlias(true);//抗锯齿

        Drawable dwincome_update = getResources().getDrawable(R.drawable.incomeupdate);
        dwincome_update.setBounds(0, 0, 100, 100);
        income_update.setCompoundDrawables(dwincome_update, null, null, null);
        income_update.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        income_update.getPaint().setAntiAlias(true);//抗锯齿

        Drawable dwincome_del = getResources().getDrawable(R.drawable.incomedel);
        dwincome_del.setBounds(0, 0, 100, 100);
        income_del.setCompoundDrawables(dwincome_del, null, null, null);
        income_del.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        income_del.getPaint().setAntiAlias(true);//抗锯齿

        Drawable dwincome_getall = getResources().getDrawable(R.drawable.incomeget);
        dwincome_getall.setBounds(0, 0, 100, 100);
        income_getall.setCompoundDrawables(dwincome_getall, null, null, null);
        income_getall.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        income_getall.getPaint().setAntiAlias(true);//抗锯齿

        Drawable dwtextView6 = getResources().getDrawable(R.drawable.tuichu);
        dwtextView6.setBounds(0, 0, 100, 100);
        textView6.setCompoundDrawables(dwtextView6, null, null, null);
        textView6.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG); //下划线
        textView6.getPaint().setAntiAlias(true);//抗锯齿


        setTitle("收入项目管理");
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.income_add:
                Toast.makeText(this,"进入收入项目增加功能",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this,IncomeAddActivity.class));
                break;
            case R.id.income_del:
                Toast.makeText(this,"进入收入项目删除功能",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this,IncomeDelAcitivity.class));
                break;
            case R.id.income_update:
                Toast.makeText(this,"进入收入项目更新功能",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this,IncomeUpdateActivity.class));
                break;
            case R.id.income_getall:
                Toast.makeText(this,"进入查看所有收入项目功能",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this,IncomeGetAllActivity.class));
                break;
            case R.id.textView6:
                Toast.makeText(this,"返回上一级",Toast.LENGTH_SHORT).show();
                startActivity(new Intent(this, MainActivity.class));
                break;
        }
    }
}
